const express = require('express')
const router = express.Router()
// 导入验证数据中间件
const expressJoi = require('@escook/express-joi')
// 导入需要验证数据的规则对象
const articleSchema = require('../schema/article')
const articleHandler = require('../router_handler/article')
/**
 * 获取文章分类接口
 */
router.get('/cates', articleHandler.getArticleCates)
/**
 * 新增文章分类接口
 */
router.post('/addCates', expressJoi(articleSchema.add_Article_Cates), articleHandler.addArticleCates)
/**
 * 删除文章接口
 */
router.delete('/delete-cate/:id', expressJoi(articleSchema.delete_cate_schema), articleHandler.deleteArticle)
/**
 * 根据id获取文章接口
 */
router.get('/cates/:id', expressJoi(articleSchema.get_cate_schema), articleHandler.getArticleById)
/**
 * 根据id更新接口
 */
router.post('/update-cate', expressJoi(articleSchema.update_cate_schema), articleHandler.updateArticleById)
module.exports = router